// components/job-item/index.js
Component({
  /**
   * 组件的属性列表
   * job = {
   *    name: String ("质量检测员")
   *    label_1: Boolean (红包)
   *    label_2: Boolean (直招)
   *    label_3: Boolean (代招)
   *    salary: String (薪资)
   *    type: Number (0-职位，1-小时工)
   *    workYear: String (工作年限) - type=0 时传入 [职位]
   *    education: Number (学历) - type=0 时传入 [职位]
   *    time: String (空闲时间) - type=1 时传入 [小时工]
   *    status: Number (状态)
   *    company: String (公司名称)
   *    area: String (所在街道)
   * }
   */
  properties: {
    job: {
      type: Object,
      value:{}
    },
    isReward: {
      type: Boolean,
      value: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    jumpDetails:function(event){
      let id = event.currentTarget.dataset.id;
      if (this.properties.isReward) {
        // 悬赏职位
        this.triggerEvent('click', {id: id});
        return ;
      }
      if (this.properties.job.type == 0) {
        wx.navigateTo({
          url: '/pages/home/job/details/details?id=' + id
        });
      } else {
        wx.navigateTo({
          url: '/pages/home/hourly/details/details?id=' + id
        });
      }
      
    }
  }
})
